<template>
  <div>
      <el-upload
          class="upload-demo"
          action="/lejuAdmin/material/uploadFileOssSave"
          :headers="headers"
          :on-success="handleChange"
          ref="lim"
          :file-list="fileList"
          :before-upload="beforeAvatarUpload"
        >
          <el-button size="small" type="primary">点击上传</el-button>
          <div slot="tip" class="el-upload__tip">
            只能上传jpg/png文件，且不超过500kb
          </div>
        </el-upload>
        <el-upload
  class="upload-demo"
  action="/lejuAdmin/material/uploadFileOssSave"
  :headers="headers"
  :show-file-list="false"
  :on-success="handleAvatarSuccess">
  <img v-if="imageUrl" :src="imageUrl" class="avatar">
  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
  </div>
</template>

<script >
import { getToken } from "@/utils/myAuth";
export default {
     props:['froms'],
  data () {
    return {
        fileList: [],
    };
  },

  components: {

  },

  computed: {},

  mounted() {},

  methods: {
      handleChange(file, fileList) {
      var _this = this;
      console.log(file);
      if (file.code == 20000) {
        this.$message.success("上传成功");
        this.findMaterialByPageAPI();
        this.$refs.lim.clearFiles();
      } else {
        this.$message.error("对不起选择失败请重新上传");
      }
      console.log(file.data.fileUrl, "file");
    },
  }
}

</script>
<style lang="scss" scoped>
</style>